<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input
      type="text"
      name="useranme"
      id="input1"
      src="./a.js"
      username="jack"
    />
    <script>
      const input = document.getElementById("input1");

      const attrs = {
        0: {
          name: "type",
          value: "text",
        },
        1: {
          name: "name",
          value: "username",
        },
        type: {
          name: "type",
          value: "text",
        },
        name: {
          name: "name",
          value: "username",
        },
      };
      console.log([...input.attributes]);
      [...input.attributes].forEach((el) => {
        console.log(el.name, el.value);
      });

      console.log(input.attributes);
      console.log(input.attributes.type.name);
      console.log(input.attributes.type.value);
    </script>
  </body>
</html>
